<?php 
session_start();
$active = 'profile';
$set = 'details';
if(!isset($_SESSION['username']) || !isset($_SESSION['id']))
{
	//header("Location: index.php");
	$redirect = '/accounts/edit_user.php';
	header("Location: ../require_login.php?redirect=".$redirect);
	exit();
} 

//echo $_SESSION['username'];
require("../db/opendb.php");
$query = "select u.*, s.ID, s.Parent_ID, s.Service from Users u left join Services s on s.ID = u.Service where u.Username='".$_SESSION["username"]."'";
$result = mysql_query($query) or die ("SQL Error".mysql_error());
$row=mysql_fetch_assoc($result);
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>

<title>Realivent.com - Edit User account</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<link rel="stylesheet" type="text/css" href="style.css">

<link rel="stylesheet" type="text/css" href="listing_panel_css.css">
<style type="text/css">@import "accounts.css";</style>

</head>
<body>
<center>
<table width="1000" border="0" cellspacing="0" cellpadding="0">
 <tr><td><?php include('accounts_top_navigation.php'); ?></td></tr>
  <tr>
    <td valign="top" style="height:300px;">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
 
    
    <div style="width:850px; float:right;">
   
    <td width="850" valign="top" align="left" id="main_body">  
	<div style="margin-top:25px;"><img src=../images/view.jpg align="absmiddle"> <a href=../../user_profile.php?id=<?php echo $_SESSION['id'] ?> target="_blank">View your profile</a></div>
	<div id="invertedtabsline">&nbsp;</div>
	<?php include('user_menu_control.php'); ?>	
	<BR><BR>
    <form action="update_user.php" method="post" enctype="application/x-www-form-urlencoded" name="detail_from">
	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
		 	<TR>
			 	<TD>
			   		<table width="100%" border="0" cellspacing="0" cellpadding="3">
				   		<tr>
                           <TD colspan="3">
                           <div style="padding-top:10px;" id="product_header"><strong>Personal details:</strong></div>
                           </TD>
				   		</tr>
                    </table>
                 </TD>
                        
			<TR>
				<td valign="top" nowrap="nowrap" align="right">First Name:</td>
				 <TD><input name="firstname" type="text" id="firstname"  value="<?php echo $row["First_Name"]; ?>"  /></TD>
				<TD>
				</td>
				</tr>
			<TR>
				<TD nowrap="nowrap" align="right">
				Last Name: 
				</TD>
				<TD>
				  <input name="lastname" type="text" id="lastname" value="<?php echo $row["Last_Name"]; ?>" />
				 </TD>
				 <TD>
				 </TD>
			</TR>
			<TR>
				<TD colspan="3">
				<div><strong>Username:</strong></div>
				  <?php echo $row["Username"]; ?>
				 </TD>

			</TR>
			<TR>
			 	<TD colspan="3">
				<div style="padding-top:10px;" id="product_header"><strong>Business Address:</strong><BR></div>
				</TD>
			 </TR>

				<tr class="listingsubheading">

                <td align="right" width=110>Street:</td>

                <td align="left"><input name="street" type="text" id="street" class="text"  size="50" value="<?php echo $row["Street"]; ?>" /></td>

                <td align="left">&nbsp;</td>

              </tr>

              	<tr class="listingsubheading">

                <td align="right">City:</td>

                <td align="left"><input name="city" type="text" id="city" class="text"  size="50" value="<?php echo $row["City"]; ?>" /></td>

                <td align="left">&nbsp;</td>

              </tr>

              	<tr class="listingsubheading">

                <td align="right">State: </td>

                <td align="left"><select name=state id=state>

							<option value="AL">AL</option>

							<option value="AK">AK</option>

							<option value="AZ">AZ</option>

							<option value="AR">AR</option>

							<option value="CA">CA</option>

							<option value="CO">CO</option>

							<option value="CT">CT</option>

							<option value="DE">DE</option>

							<option value="DC">DC</option>

							<option value="FL">FL</option>

							<option value="GA">GA</option>

							<option value="HI">HI</option>

							<option value="ID">ID</option>

							<option value="IL">IL</option>

							<option value="IN">IN</option>

							<option value="IA">IA</option>

							<option value="KS">KS</option>

							<option value="KY">KY</option>

							<option value="LA">LA</option>

							<option value="ME">ME</option>

							<option value="MD">MD</option>

							<option value="MA">MA</option>

							<option value="MI">MI</option>

							<option value="MN">MN</option>

							<option value="MS">MS</option>

							<option value="MO">MO</option>

							<option value="MT">MT</option>

							<option value="NE">NE</option>

							<option value="NV">NV</option>

							<option value="NH">NH</option>

							<option value="NJ">NJ</option>

							<option value="NM">NM</option>

							<option value="NY">NY</option>

							<option value="NC">NC</option>

							<option value="ND">ND</option>

							<option value="OH">OH</option>

							<option value="OK">OK</option>

							<option value="OR">OR</option>

							<option value="PA">PA</option>

							<option value="RI">RI</option>

							<option value="SC">SC</option>

							<option value="SD">SD</option>

							<option value="TN">TN</option>

							<option value="TX">TX</option>

							<option value="UT">UT</option>

							<option value="VT">VT</option>

							<option value="VA">VA</option>

							<option value="WA">WA</option>

							<option value="WV">WV</option>

							<option value="WI">WI</option>

							<option value="WY">WY</option>

						</select>			



				 <script language="JavaScript" type="text/javascript">

				  var cval = "<?php echo $row['State']; ?>";

						for(i=0;i<document.forms[0].state.options.length;i++)

							if(document.forms[0].state.options[i].value==cval)

								document.forms[0].state.options[i].selected=true;

					</script>

									

					  </td>

                <td align="left">&nbsp;</td>

              </tr>

              	<tr class="listingsubheading">

                <td align="right">Zip: </td>

                <td align="left"><input name="zip" type="text" id="zip" class="text"  size="20" value="<?php echo $row["Zip"]; ?>" /></td>

                <td align="left">&nbsp;</td>

              </tr>

				</table>

			  	<table width="100%" border="0" cellspacing="0" cellpadding="3">

			  <TR>

			  <TD colspan="3"><div style="padding-top:10px;" id=product_header><strong>Contact Information:</strong></div></TD>

			  </TR>

			<tr class="listingsubheading">

                <td align="right" width="110">Email: </td>

                <td align="left"><input name="email" type="text" id="email" class="text" size=50 value="<?php echo $row["Email"]; ?>" /></td>

                <td align="left">&nbsp;</td>

              </tr>

              <tr class="listingsubheading">

                <td align="right">Phone: </td>

                <td align="left"><input name="phone" type="text" id="phone" class="text" size=30 value="<?php echo $row["Phone"]; ?>" /></td>

                <td align="left">&nbsp;</td>

              </tr>

			   <tr class="listingsubheading">

                <td align="right">fax:</td>

                <td align="left"><input name="fax" type="text" id="website" class="text"  size="30" value="<?php echo $row["Fax"]; ?>" /></td>

                <td align="left">&nbsp;</td>

              </tr>
              
               <tr class="listingsubheading">

                <td align="right">Facebook:</td>

                <td align="left"><input name="facebook" type="text" id="facebook" class="text" value="<?php echo $row["facebook"]; ?>" /></td>

                <td align="left">&nbsp;</td>

              </tr>
              
               <tr class="listingsubheading">

                <td align="right">Twitter:</td>

                <td align="left"><input name="twitter" type="text" id="twitter" class="text" value="<?php echo $row["twitter"]; ?>" /></td>

                <td align="left">&nbsp;</td>

              </tr>

			  

				</table>

				<table width="100%" border="0" cellspacing="0" cellpadding="3">

					<TR>

					<TD colspan="3"><div style="padding-top:10px;" id=product_header><strong>Professional Information:</strong></div>

					</TD>

					</TR>

					



					

			<tr class="listingsubheading">

                <td align="right" width=130>Website:</td>

                <td align="left"><input name="website" type="text" id="website" class="text"  size="50" value="<?php echo $row["Website"]; ?>" /></td>

                <td align="left">&nbsp;</td>

              </tr>

			  

			  <tr class="listingsubheading">

                <td align="right" width=130>Website2:</td>

                <td align="left"><input name="website2" type="text" id="website2" class="text"  size="50" value="<?php echo $row["Website2"]; ?>" /></td>

                <td align="left">&nbsp;</td>

              </tr>

			  

			  

			  

			  <tr class="listingsubheading">

                <td align="right" width=130 nowrap="nowrap">Home Search URL:</td>

                <td align="left"><input name="home_search" type="text" id="home_search" class="text"  size="50" value="<?php echo $row["Home_Search_URL"]; ?>" /></td>

                <td align="left">&nbsp;</td>

              </tr>

              <tr class="listingsubheading">

                <td align="right">Company Name / Brokerage:</td>

                <td align="left"><input name="broker" type="text" id="broker" class="text"  size="50" value="<?php echo $row["Brokerage"]; ?>" /></td>

                <td align="left">&nbsp;</td>

              </tr>

			  <tr class="listingsubheading">

                <td align="right">License Number:</td>

                <td align="left"><input name="license" type="text" id="license" class="text"  size="50" value="<?php echo $row["License_Number"]; ?>" /></td>

                <td align="left"></td>

              </tr>

			  <TR>

			  	<TD colspan="3">

					<input name="submit" type="submit" value="Update">

				</TD>

			  </TR>

					</table>

 			</div>
	</form>
	</td>
    
    
	<td valign="top" rowspan="2">
			<table style="border:1px dashed #CCCCCC; padding:10px;" border="0" cellspacing="0" cellpadding="0">
				  <tr>
					<td valign="top" align="left" style="padding:5px;">
					<?php 
					if($row['Image'] != '')
					{
					list($width_orig, $height_orig, $image_type) = getimagesize('../user_images/'.$row['Image']);
					$width = 100;
					$ratio = $width/$width_orig;
					$height = $height_orig*$ratio;
					?>

					<div style="font-size:10px;padding:5px;">Click on image for full size</div>
					<a href=# onClick="window.open('../user_images/<?php echo $row['Image'] ?>','name','location=no,width=<?php echo $width_orig+20; ?>,height=<?php echo $height_orig+20; ?>');"><img border="0" align="left" width=<?php echo $width; ?> height="<?php echo $height; ?>" src=../user_images/<?php echo $row['Image']; ?> /></a>

					<div style="float:right; margin-top:100px;">
					
					<?php
					echo 'Width= '.$width_orig."px<BR>";
					echo 'Height= '.$height_orig."px<BR>";
					echo "<a href=delete_agent_picture.php>[delete]</a></div>";
					} 
					else
					{
					?>
					<img src=../images/blank_agent_image.gif />
					<?
					}
					?>
					</td>
				</tr>
					<TR>
					<td valign="top" nowrap="nowrap">
						<form action="add_agent_image.php" method="post" enctype="multipart/form-data" name="photos">
						<input size="10" name="image_file" type="file" />
						<input type=submit value=add>
						</form>
					</td>
				  </tr>
				  <tr>
					<td valign="top" align="left" style="padding:5px;">
					<?php if($row['Company_Logo'] != '')
					{
					list($width_orig, $height_orig, $image_type) = getimagesize('../user_images/'.$row['Company_Logo']);
					if($width_orig > 100)
					{
					$width = 100;
					$ratio = $width/$width_orig;
					$height = $height_orig*$ratio;
					}
					else
					{
					$width = $width_orig;
					$height = $height_orig;
					}
					?>

					<div style="font-size:10px;padding:5px;">Click on image for full size</div>
					<a href=# onClick="window.open('../user_images/<?php echo $row['Company_Logo'] ?>','name','location=no,width=<?php echo $width_orig+20; ?>,height=<?php echo $height_orig+20; ?>');"><img border= 0 align="left" width=<?php echo $width; ?> height="<?php echo $height; ?>" src=../user_images/t_<?php echo $row['Company_Logo']; ?> /></a>
					
					<?php
					echo 'Width= '.$width_orig."px<BR>";
					echo 'Height= '.$height_orig."px<BR>";
					echo "<a href=delete_agent_logo.php>[delete]</a></div>";
					} 
					else
					{
					?>
					<img src=../images/blank_logo.gif />
					<?
					}
					?>
					</td>
					</tr>
					<TR>
					<td valign="top" nowrap="nowrap">
						<form action="add_agent_logo.php" method="post" enctype="multipart/form-data" name="logos">
						<input size="10" name="image_file" type="file" />
						<input type=submit value=add>
						</form>
						</td>
				 	 </tr>
					</table>
	</td>

	</div>

</table>

<?php include('../footer.php'); ?>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-2413582-1");
pageTracker._trackPageview();
} catch(err) {}</script>

</center>
</body>
</html>